Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: OpenDoc Class Reference /
Part 1 - Classes and Methods


ODUndo

Superclasses
ODObject
Subclasses
none

An object of the ODUndo class holds command history information to support the undo capability--the ability to reverse the effects of recently executed commands--of OpenDoc.

Description

Your part editor stores undoable actions in, and retrieves them from, the undo object. When a document is opened, the session object creates a single undo object. All parts of that document share the undo object; you can obtain a reference to it by calling the session object's GetUndo method (page 611).

The undo object contains an undo stack and a redo stack. When an undoable action is performed, the part involved places action data--information provided by the part that allows it to reverse the effects of an undoable action--on the undo stack. OpenDoc stores the action data in the undo object's action history--the cumulative set of reversible actions available at any one time. When an action needs to be undone, OpenDoc pops the action data from the undo stack onto the redo stack. At the same time, OpenDoc notifies your part so that your part can undo the recently executed action using the stored action data. When an undone action needs to be redone, OpenDoc pops the action data from the redo stack back onto the undo stack. OpenDoc notifies your part so that your part can redo the recently undone action using the stored action data. The undo and redo stacks can be cleared upon a part's request. When clearing is needed, OpenDoc asks each part to dispose of its action data stored in the stacks. The order of disposal is from newer actions to older actions.

There are times when an action subhistory--a subset of reversible actions available at any one time--is useful. For example, you may need a new action context when entering a modal state, that is, when your part displays a modal dialog box. OpenDoc allows marks to be placed on the stacks. If a mark is placed on a stack, the stack may be cleared only to the mark. For example, when the modal dialog box closes, any actions done within the context of the modal dialog box are disposed of. However, all the actions executed before the modal dialog box appeared are preserved in the stacks.

Methods

This section presents summary descriptions of the ODUndo methods grouped according to purpose, followed by detailed descriptions in alphabetical order. Methods marked [D] are called only by the document shell or container applications.

Action History Manipulation

AddActionToHistory
Pushes the action data and its associated part onto the undo stack.
AbortCurrentTransaction
Removes the current transaction (and any nested transactions) from the action history.
ClearActionHistory
Clears the undo and redo stacks.
MarkActionHistory
Marks the top of the undo and redo stacks.
Undo

Undo [D]
Undoes the top action in the undo stack.
PeekUndoHistory
Returns a Boolean value that indicates whether there is anything on the undo stack and gets information about the action at the top of the undo stack.
Redo

Redo [D]
Redoes the top action in the redo stack.
ClearRedoHistory
Clears the redo stack.
PeekRedoHistory
Returns a Boolean value that indicates whether there is anything on the redo stack and gets information about the action at the top of the redo stack.

Methods
AbortCurrentTransaction
AddActionToHistory
ClearActionHistory
ClearRedoHistory
MarkActionHistory
PeekRedoHistory
PeekUndoHistory
Redo
Undo

Previous Book Contents Book Index Next

© Apple Computer, Inc.
17 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help